package com.dengyiming.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dengyiming.user.mapper.UserMapper;
import com.dengyiming.user.pojo.User;
import com.dengyiming.user.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService extends ServiceImpl<UserMapper, User> implements IUserService {

    @Autowired
    private UserMapper userMapper;
    @Override
    public User userList(String username, String password) {

        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("username",username);
        wrapper.eq("password",password);
        List<User> users = userMapper.selectList(wrapper);
        if (users != null && users.size()!=0){
            User user = users.get(0);
        return user;
        }
        return null;
    }
}